//
//  UILabel+AtttStr.m
//  NBProduct
//
//  Created by ping on 15/10/26.
//  Copyright (c) 2015年 ping. All rights reserved.
//

#import "UILabel+AtttStr.h"


@implementation UILabel (AtttStr)

-(void)returnAttributedStrWith:(NSString *)str Color1:(UIColor *)color1 Color2:(UIColor *)color2 withLocation:(int)location AndFontSizt:(CGFloat)fontSize{
    NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc]initWithString:str];
    
    [attributeStr addAttribute:NSForegroundColorAttributeName
                         value:color1 range:NSMakeRange(0,location)];
    [attributeStr addAttribute:NSForegroundColorAttributeName
                         value:color2 range:NSMakeRange(location,str.length - location )];
    [attributeStr addAttribute:NSFontAttributeName
     
                value:[UIFont systemFontOfSize:fontSize]
     
                range:NSMakeRange(0, str.length)];
    
    self.attributedText = attributeStr;

}

-(void)returnAttributedStrWith:(NSString *)str Color1:(UIColor *)color1 Color2:(UIColor *)color2 withLocation:(int)location AndFontSizt:(CGFloat)fontSize andAttlength:(NSInteger )attlength{
    
    NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc]initWithString:str];
    
    [attributeStr addAttribute:NSForegroundColorAttributeName
                         value:color1 range:NSMakeRange(0,location)];
    
    [attributeStr addAttribute:NSForegroundColorAttributeName
                         value:color2 range:NSMakeRange(location,attlength)];
    [attributeStr addAttribute:NSForegroundColorAttributeName
                         value:color1 range:NSMakeRange(location + attlength,str.length - location - attlength)];
    
    [attributeStr addAttribute:NSFontAttributeName
     
                         value:[UIFont systemFontOfSize:fontSize]
     
                         range:NSMakeRange(0, str.length)];
    
    self.attributedText = attributeStr;
    

}

+(UILabel *)drawXiaHuaXianLabel:(float)height{
    UILabel *fengeLabel1 = [[UILabel alloc]initWithFrame:CGRectMake(0, height, KScreenWidth, 0.5)];
    fengeLabel1.backgroundColor = XiaHuaXianCOLOR;
    

    return fengeLabel1;
}

-(float)sizeWithFont:(UIFont *)font
{
    return 0;
}


@end
